<?php

namespace App\Http\Middleware\Mobile\Common;

use Closure;
use EasyWeChat\Foundation\Application;

class WechatShareMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $app = new Application(config('wechat'));
        $js = $app->js;
        $request->attributes->set('js', $js);
        return $next($request);
    }
}
